home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Window / c / DeleteOrig < prev    next >
Text File  |  1995-07-21  |  2KB  |  65 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Window.DeleteOrig.c
  12.     Author:  Copyright © 1995 Sergio Monesi (original code from
  13.                               Window.Delete.c by Jason Williams)
  14.     Version: 1.00 (15 Feb 1995)
  15.     Purpose: High-level window management functions: Delete a window
  16.              created with Window_CreateOrig
  17. */
  18.  
  19.  
  20. #include "DeskLib:LinkList.h"
  21. #include "DeskLib:WimpSWIs.h"
  22. #include "DeskLib:Template.h"
  23. #include "DeskLib:Event.h"
  24. #include "DeskLib:EventMsg.h"
  25. #include "DeskLib:Window.h"
  26. #include "DeskLib:Screen.h"
  27. #include "DeskLib:Error.h"
  28. #include "DeskLib:Window.h"
  29.  
  30. #include "WindowDefs.h"
  31.  
  32. #include <stdlib.h>
  33. #include <string.h>
  34.  
  35.  
  36. extern linklist_header window_listanchor;
  37.  
  38.  
  39.  
  40. extern void Window_DeleteOrig(window_handle window)
  41. {
  42.   windowrec       *ptr;
  43.  
  44.   Event_ReleaseWindow(window);       /* Release all handlers for this window */
  45.   EventMsg_ReleaseWindow(window);
  46.  
  47.   Wimp_CloseWindow(window);                                  /* say bye bye! */
  48.   Wimp_DeleteWindow(window);
  49.  
  50.   ptr = (windowrec *) window_listanchor.next;
  51.   while (ptr != NULL)
  52.   {
  53.     if (ptr->window == window)
  54.       break;
  55.     ptr = (windowrec *) ptr->header.next;
  56.   }
  57.  
  58.   if (ptr == NULL)
  59.     return;              /* Window not created with Window_Show(). Bad user! */
  60.  
  61.   LinkList_Unlink(&window_listanchor, &(ptr->header));
  62.  
  63.   free(ptr);                         /* Free up the window's list entry      */
  64. }
  65.